package com.xzm.utils.test_excel.controller;

import com.xzm.utils.test_excel.entity.ExcelDO;
import com.xzm.utils.ExcelUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * @author 90560
 * @version 1.0
 * @date 2022/7/18 22:44
 */
@Slf4j
@RestController
public class DemoController {

    /**
     * 测试导入 Excel 通用方法功能
     */
    @GetMapping("/testImportExcel")
    public List<ExcelDO> testImport(@RequestBody MultipartFile file) {
        List<ExcelDO> list = ExcelUtils.getExcelReader(file, ExcelDO.class, "2班");
        list.forEach(System.out::println);
        return list;
    }

}
